package com.example.shardingspheretest.controller;


import com.example.shardingspheretest.entity.User;
import com.example.shardingspheretest.mapper.UserMapper;
import com.example.shardingspheretest.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserMapper userMapper;
    @Resource
    private UserService userService;

    @GetMapping("selectAll")
    public void selectAll(){
        userMapper.selectList(null);
    }

    @PostMapping("insert")
    public void insert(User user){
        userService.insert(user);
    }

}
